<template>
  <div class="icon">
    <swiper>
      <!-- slides -->
      <swiper-slide v-for="(page,index) in pages" :key="index">
        <div class="icons" v-for="iconList in page" :key="iconList.id">
          <div class="icons-img">
            <img class="icons-img_content" :src="iconList.imgUrl" alt />
          </div>
          <p class="icon-text">{{iconList.text}}</p>
        </div>
      </swiper-slide>
      <div class="swiper-pagination-icon" slot="pagination"></div>
    </swiper>
  </div>
</template>
<script>
export default {
  name: "HomeIcon",
  data() {
    return {
      iconLists: [
        {
          id: "001",
          text: "青岛啤酒节青岛博物馆黄岛区分区",
          imgUrl:
            "http://mp-piao-admincp.qunarzz.com/mp_piao_admin_mp_piao_admin/admin/20194/e48e868a92b508a04da2a3bfdd35d4cd.png"
        },
        {
          id: "002",
          text: "青岛啤酒节",
          imgUrl:
            "http://mp-piao-admincp.qunarzz.com/mp_piao_admin_mp_piao_admin/admin/20194/e48e868a92b508a04da2a3bfdd35d4cd.png"
        },
        {
          id: "003",
          text: "青岛啤酒节",
          imgUrl:
            "http://mp-piao-admincp.qunarzz.com/mp_piao_admin_mp_piao_admin/admin/20194/e48e868a92b508a04da2a3bfdd35d4cd.png"
        },
        {
          id: "004",
          text: "青岛啤酒节",
          imgUrl:
            "http://mp-piao-admincp.qunarzz.com/mp_piao_admin_mp_piao_admin/admin/20194/e48e868a92b508a04da2a3bfdd35d4cd.png"
        },
        {
          id: "005",
          text: "青岛啤酒节",
          imgUrl:
            "http://mp-piao-admincp.qunarzz.com/mp_piao_admin_mp_piao_admin/admin/20194/e48e868a92b508a04da2a3bfdd35d4cd.png"
        },
        {
          id: "006",
          text: "青岛啤酒节",
          imgUrl:
            "http://mp-piao-admincp.qunarzz.com/mp_piao_admin_mp_piao_admin/admin/20194/e48e868a92b508a04da2a3bfdd35d4cd.png"
        },
        {
          id: "007",
          text: "青岛啤酒节",
          imgUrl:
            "http://mp-piao-admincp.qunarzz.com/mp_piao_admin_mp_piao_admin/admin/20194/e48e868a92b508a04da2a3bfdd35d4cd.png"
        },
        {
          id: "008",
          text: "青岛啤酒节",
          imgUrl:
            "http://mp-piao-admincp.qunarzz.com/mp_piao_admin_mp_piao_admin/admin/20194/e48e868a92b508a04da2a3bfdd35d4cd.png"
        },
        {
          id: "009",
          text: "青岛啤酒节",
          imgUrl:
            "http://mp-piao-admincp.qunarzz.com/mp_piao_admin_mp_piao_admin/admin/20194/e48e868a92b508a04da2a3bfdd35d4cd.png"
        }
      ]
    };
  },
  computed: {
    pages() {
      const pages = [];
      this.iconLists.forEach((item, index) => {
        const page = Math.floor(index / 8);
        if (!pages[page]) {
          pages[page] = [];
        }
        pages[page].push(item);
      });
    return pages;
    }
  },
  methods:{
  
  },
  created(){
  }
};
</script>
<style lang="scss" scoped>
@import "~@style/common/common.scss";
.swiper-container {
  overflow: hidden;
  width: 100%;
  height: 0;
  padding-bottom: 50%;
  .icons {
    overflow: hidden;
    float: left;
    width: 25%;
    height: 0;
    padding-bottom: 25%;
    position: relative;
    .icons-img {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 25px;
      box-sizing: border-box;
      padding: 5px;
      .icons-img_content {
        display: block;
        margin: 0 auto;
        height: 100%;
      }
    }
    .icon-text {
      position: absolute;
      left: 0;
      bottom: 0;
      right: 0;
      height: 25px;
      line-height: 25px;
      text-align: center;
      color: $darkTextColor;
      @include ellipse;
    }
  }
}
</style>